home *** CD-ROM | disk | FTP | other *** search
/ AOL File Library: 2,801 to 2,900 / aol-file-protocol-4400-2801-to-2900.zip / AOLDLs / C++ Files Library / Graphic Gems I, II & III (C_C++) / Graphics Gems C Code.sea / GemsI / Src / AALines / LongConst.h < prev    next >
Text File  |  1992-06-16  |  2KB  |  51 lines

  1. /*  FILENAME:   LongConst.h  [revised 18 AUG 90]
  2.  
  3.     AUTHOR:  Kelvin Thompson
  4.  
  5.     DESCRIPTION:  High-precision constants.  If this file is included
  6.       in the same file as GraphicsGems.h, this file must come *after*
  7.       GraphicsGems.h.  (It's okay to use this file without GraphicsGems.h.)
  8.  
  9.         The standard _Graphics_Gems_ include file has some constants
  10.       that do not have full double-precision accuracy.  This file
  11.       has the constants to a ridiculously high precision.  See pages
  12.       434-435 of _Graphics_Gems_.  I got the constants from Mathematica.
  13.       
  14.         Also, this file has a constant and macro for finding the base-two
  15.       logarithm of a number.
  16. */
  17.  
  18. /* prevent multiple inclusion */
  19. #ifndef __LONGCONST_H__
  20. #define __LONGCONST_H__
  21.  
  22. /* first get rid of stuff from GraphicsGems.h */
  23. #undef PI
  24. #undef PITIMES2
  25. #undef PIOVER2
  26. #undef E
  27. #undef SQRT2
  28. #undef SQRT3
  29. #undef GOLDEN
  30. #undef DTOR
  31. #undef RTOD
  32.  
  33. /* re-define basic constants with high precision */
  34. #define PI     3.141592653589793238462643383279502884197169399375105820975
  35. #define E      2.718281828459045235360287471352662497757247093699959574967
  36. #define SQRT2  1.414213562373095048801688724209698078569671875376948073177
  37. #define SQRT3  1.732050807568877293527446341505872366942805253810380628056
  38. #define GOLDEN 1.618033988749894848204586834365638117720309179805762862135
  39.  
  40. /* re-define derived constants */
  41. #define PITIMES2  (2.0*PI)
  42. #define PIOVER2   (0.5*PI)
  43. #define DTOR      (PI/180.0)
  44. #define RTOD      (180.0/PI)
  45.  
  46. /* macro and constant for base 2 logarithm */
  47. #define LN2    0.693147180559945309417232121458176568075500134360255254121
  48. #define LOG2(val) (log(val)*(1.0/LN_2))
  49.  
  50. #endif  /* __LONGCONST_H__ */
  51.